package com.taptech.doufu.ui.view.personalcenter;

import android.content.Context;
import android.util.AttributeSet;
import android.view.Gravity;
import android.view.View;
import android.widget.PopupWindow;
import android.widget.TextView;

import com.taptech.doufu.util.ScreenUtil2;
import com.taptech.doufu.R;
import com.taptech.doufu.services.personalcenter.PersonalInfoService;
import com.taptech.doufu.ui.activity.PersonalInviteWeiboContactActivity;

public class WeiboMessageWindow extends PopupWindow {

	PersonalInviteWeiboContactActivity activity;

	public WeiboMessageWindow(PersonalInviteWeiboContactActivity activity) {
		super(activity);
		this.activity = activity;
		initView(activity);
	}

	public WeiboMessageWindow(Context context) {
		super(context);
	}

	public WeiboMessageWindow(Context context, AttributeSet attrs) {
		super(context, attrs);
	}

	private void initView(PersonalInviteWeiboContactActivity activity) {
		setWidth((int) (ScreenUtil2.getScreenWidthPixel(activity) * 0.9));
		setHeight(ScreenUtil2.dip2px(340));
		setAnimationStyle(R.style.Animations_PopUpMenu_Center);
		View baseView = activity.getLayoutInflater().inflate(
				R.layout.personal_center_component_weibo_invite_window, null);
		TextView message = (TextView) baseView.findViewById(R.id.weibo_message);
		message.setText(PersonalInfoService.getInstance().getInviteMessage(
				activity.inviteCode,activity.groupName));
		setContentView(baseView);
		showAtLocation(activity.getWindow().getDecorView(), Gravity.CENTER, 0,
				0);
	}

}
